﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LMS.SMSH.MODEL;
using LMS.SMSH.BLL;
using System.Data.Linq;
using System.Data; 

namespace LMS.SMSH.WEB
{
    public partial class StuAllPorject : System.Web.UI.Page
    {
        Int32 rowNo = 0;//行编号
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bingGvAllProject();
            }
        }
        /// <summary>
        /// 绑定gvStuProject
        /// </summary>
        private void bingGvAllProject()
        {
            gvAllProject.DataSource = LMSDataContext.GetLMSDB.sp_viewPro();
            gvAllProject.DataKeyNames = new string[] { "proId" };
            gvAllProject.DataBind();
        }

        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvAllProject_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvAllProject.PageIndex = e.NewPageIndex;
            bingGvAllProject();
        }

        /// <summary>
        /// 行数据绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvAllProject_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                rowNo++;
                //行编号
                e.Row.Cells[0].Text = (gvAllProject.PageIndex * gvAllProject.PageSize + rowNo).ToString();
                //鼠标悬停变色
                e.Row.Attributes.Add("onmouseover", "oldBG=this.style.backgroundColor;this.style.backgroundColor='#FF1199';");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=oldBG;");
            }
        }


    }
}